<!--
/**
 * @file Rules_Actions.html
 * @author Alejandro Dario Simi
 * @date $Date: 2013-08-05 00:26:28 +0000 (Mon, 05 Aug 2013) $
 *
 * $Id: Rules_Actions.html 100 2013-08-05 00:26:28Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/branches/wcomix-1.0/docs/Rules_Actions.html $
 */
-->
<html>
	<head>
		<title>Rules &amp; Actions</title>
		<script type="text/javascript" src="jquery-1.8.0.min.js"></script>

		<script type="text/javascript" src="SyntaxHighlighter/scripts/shCore.js"></script>
		<link type="text/css" rel="stylesheet" href="SyntaxHighlighter/styles/shCoreEclipse.css"/>
		<link type="text/css" rel="stylesheet" href="SyntaxHighlighter/styles/shThemeEclipse.css"/>
		<script type="text/javascript">SyntaxHighlighter.all();</script>

		<link rel="stylesheet" type="text/css" href="docs.css"/>
		<script type="text/javascript" src="docs.js"></script>
	</head>
	<body>
		<div class="Section">
			<span class="Title">Table Of Contents</span>
			<div class="TableOfContents"></div>
		</div>
		<div class="Section">
			<span class="Title">Rules</span>
			<div class="Paragraph">
				<p>A rule is a list of actions to be taken based on some characteristic of a comic. For example, if a comic is tag with
				"Rei Ayanami", it could be useful to automatically tag it with others like "Neon Genesis Evangelion", " Gainax" and
				also "Hideaki Anno".</p>
				<p>This kind of behavior can be seen as a single rule, perhaps called "Neon Genesis Evangelion" with three action, one
				per each tag to be added automatically.</p>
			</div>
		</div>
		<div class="Section">
			<span class="Title">Actions</span>
			<div class="Paragraph">
				<p>Actions are a bit more complex concept, and this is because wcomix knows how to use a generic type of action which is
				not useful for any rule. Therefore, this generic type of action must me specified and implemented in the right way.</p>
				<p>By default, wcomix provides a set of action type through an extension call 'TagsRelator'. This action type are also
				called 'modes' and they are:<ul>
					<li>[CO:ALSO]: This kind of action gets comics with certain tag and 'also' add others.</li>
					<li>[CO:IF]: This one search comics having a tag from a list and a specific tag.</li>
					<li>[CO:POOL]: This one enforces that those comics that have a tag of its list, also have the other tags from
					the list.</li>
				</ul></p>
			</div>
		</div>
		<div class="Section">
			<span class="Title">Actions Hooks</span>
			<div class="Paragraph">
				<p>wcomix provides a global array containing hooks to use actions. This hook holder is called [VA:$wcRuleHooks] and every
				element in it must be an associative array that may look like this (the examples is based on extension 'TagsRelator'):</p>
				<pre class="brush: php;">
$wcRuleHooks["TARE"] = array(
        "name"        => "Tags Relator",
        "description" => "Enforce relation between tags",
        "author"      => "Alejandro Dario Simi",
        "version"     => "1.0",
        "url"         => array(                                       // Optional
                "title" => "wcomix:Extension:TagsRelator",
                "href"  => "http://wiki.daemonraco.com/wiki/Wcomix:Extension:TagsRelator"
        )

        "class"       => "TagsRelator",
        "conficts"    => "TagsRelator::MarkConflicts",                // Optional
        "lock-tags"   => "TagsRelator::LockedTagIds",                 // Optional

        //
        // Canvas hooks
        "create"      => "tare.create",
        "edit"        => "tare.edit",
        "remove"      => "tare.remove"
);</pre>
				<p><ul>
					<li>[CO:name]: Action name.</li>
					<li>[CO:description]:	Short description for this kind of action.</li>
					<li>[CO:author]: Extension's author.</li>
					<li>[CO:version]: Extension's version.</li>
					<li>[CO:url]: URL when this extension can be visited, in other words, the extension's home page.</li>
						<li>[CO:title]: Home page title.</li>
						<li>[CO:href]: Home page URL.</li>
					<li>[CO:class]: This should be a the name of the class used to manage this kind of actions. It must
					inherit from [CL:WCRuleAction].</li>
					<li>[CO:conficts]: This optional field holds the name of a function to be called when this kind of actions
					must check for conflits bewtween rules.</li>
					<li>[CO:lock-tags]: This optional field holds the name of a function used to retrieve a list of tags that
					cannot be remove even if they have no members.</li>
					<li>Canvas: Every action type should have three canvas pages to use as modify actions.<ul>
						<li>[CO:create]: Canvas page to create an action of this kind.</li>
						<li>[CO:edit]: Canvas page to edit an action of this kind.</li>
						<li>[CO:remove]: Canvas page to remove an action of this kind.</li>
					</ul></li>
				</ul></p>
				<p>The ID give for the hook is very important because it's used across the whole application with many purposes. So, in
				this case, the id '{CL:TARE}' is really important.</p>
			</div>
		</div>
	</body>
</html>